Skip to content

feat(metrics): Add integration with installation by SDK#6956

Merged
philprime merged 50 commits intomainfrom
philprime/metrics-bootstrap
Jan 15, 2026
Merged

feat(metrics): Add integration with installation by SDK#6956
philprime merged 50 commits intomainfrom
philprime/metrics-bootstrap

Conversation

@philprime
Copy link
Member

@philprime philprime commented Dec 2, 2025

This PR is part of a merge-chain and should be merged one-by-one into main as soon as all of them are ready to be merged:

  1. feat(metrics): Add integration with installation by SDK #6956
  2. feat(metrics): Add implementation for metrics envelope item #6960
  3. feat(metrics): Add public API to collect count, distribution and gauge #6957

📜 Description

This pull request introduces a new metrics integration to the Sentry SDK for Swift, allowing users to enable metrics collection and reporting via the SDK. The changes include the addition of the enableMetrics option, implementation of the metrics integration, updates to the SDK configuration, and new tests to verify the integration. The project structure is also updated to include the new integration and its tests.

Metrics Integration Feature:

  • Added a new enableMetrics option to SentryOptions, allowing users to enable or disable metrics collection. [1] [2]
  • Implemented MetricsIntegration, which is installed when enableMetrics is set to true. [1] [2]
  • Updated the SDK wrapper and options validation to support the new enableMetrics option. [1] [2]
  • Updated the enabled features builder to include "metrics" when the feature is enabled.

💡 Motivation and Context

Closes #6954

💚 How did you test it?

  • Added unit tests based on the existing option enableLogs
  • Added unit tests based on the session replay integration
  • Added option to enable metrics to run arguments in scheme
    • Enabled the option, ran the macOS sample app and checked that the "Integration initialized" log message shows up.

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed. → [Metrics] Add documentation for feature #7045
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 1f1ae79

@philprime philprime self-assigned this Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.826%. Comparing base (d52e416) to head (1f1ae79).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #6956       +/-   ##
=============================================
+ Coverage   84.770%   84.826%   +0.056%     
=============================================
  Files          461       462        +1     
  Lines        27860     27871       +11     
  Branches     12320     12333       +13     
=============================================
+ Hits         23617     23642       +25     
- Misses        3979      4188      +209     
+ Partials       264        41      -223     
Files with missing lines Coverage Δ
SentryTestUtils/Sources/TestOptions.swift 100.000% <100.000%> (ø)
Sources/Swift/Core/Integrations/Integrations.swift 100.000% <100.000%> (ø)
...es/Swift/Helper/SentryEnabledFeaturesBuilder.swift 100.000% <100.000%> (ø)
...ntegrations/Metrics/SentryMetricsIntegration.swift 100.000% <100.000%> (ø)
Sources/Swift/SentryExperimentalOptions.swift 75.000% <100.000%> (+8.333%) ⬆️

... and 36 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d52e416...1f1ae79. Read the comment docs.

@philprime philprime marked this pull request as draft December 2, 2025 13:57
@philprime
Copy link
Member Author

@cursor review
@sentry review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


@philprime philprime force-pushed the philprime/metrics-bootstrap branch from a5056fb to 1210307 Compare December 2, 2025 15:13
- Introduced new test file `SentryItemBatcherTests.swift` to validate the behavior of the `SentryItemBatcher`.
- Added tests for various scenarios including item addition, buffer size limits, timeout handling, and attribute enrichment.
- Updated project configuration to include the new test file in the build settings.
@philprime
Copy link
Member Author

After reconsideration and learnings while working on #6957 I decided that I will move this feature to be marked as "experimental" first to keep some leeway to react if the public API using Swift Language features such as ExpressibleByInt is not working as expected.

@philprime philprime added the dontmerge A branch that absolutely should not be merged while this label is applied. label Dec 22, 2025
@philprime philprime enabled auto-merge (squash) January 15, 2026 14:04
@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (metrics) Add integration with installation by SDK by philprime in #6956
  • Add isiOSAppOnVisionOS, isiOSAppOnMac, isMacCatalystApp to device context by philprime in #6939

Bug Fixes 🐛

  • (logs) Use sendDefaultPii and span_id for attributes by philprime in #7055
  • Fix incorrect variable assignment for 'sampled' key by xjshi in #7120
  • Mark dark theme deprecated by noahsmartin in #7114
  • Update raw_description in runtime context for Mac Catalyst App by philprime in #7082
  • Use correct parsing for stackframes by noahsmartin in #6908
  • Transport correctly handling 4xx and 5xx by dfed in #6618

Build / dependencies / internal 🔧

Deps

  • Bump ruby/setup-ruby from 1.279.0 to 1.281.0 by dependabot in #7160
  • Bump getsentry/craft from 2.18.1 to 2.18.3 by dependabot in #7161
  • Bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.18.1 to 2.18.3 by dependabot in #7159
  • Bump ruby/setup-ruby from 1.276.0 to 1.279.0 by dependabot in #7117
  • Bump mikepenz/action-junit-report from 6.0.1 to 6.1.0 by dependabot in #7116
  • Update swiftlint version by github-actions in #7109
  • Bump ruby/setup-ruby from 1.275.0 to 1.276.0 by dependabot in #7103
  • Bump codecov/test-results-action from 1.1.1 to 1.2.1 by itaybre in #7087
  • Bump ruby/setup-ruby from 1.270.0 to 1.275.0 by itaybre in #7088
  • Bump peter-evans/create-pull-request from 7.0.11 to 8.0.0 by dependabot in #7084
  • Bump actions/download-artifact from 6 to 7 by dependabot in #7048
  • Bump aws-sdk-s3 from 1.205.0 to 1.208.0 by dependabot in #7074
  • Bump ruby/setup-ruby from 1.269.0 to 1.270.0 by dependabot in #7049
  • Update clang-format version by github-actions in #7056
  • Bump actions/cache from 4 to 5 by dependabot in #7052
  • Bump actions/upload-artifact from 5 to 6 by dependabot in #7050
  • Bump codecov/codecov-action from 5.5.1 to 5.5.2 by dependabot in #7051

Other

  • (dx) Add structured Makefile with usage description by philprime in #7129
  • (release) Switch from action-prepare-release to Craft (minimal) by BYK in #7153
  • Update iOS test destination OS version to 18.5 in fast-pr-checks workflow by itaybre in #7168
  • Fix typos in comments in multiple files v2 by philipphofmann in #7139
  • Run visionOS tests on Cirrus Runners + Boot simulator by itaybre in #7147
  • Skip jobs/steps that require secrets for non contributors by itaybre in #7124
  • Add attributable protocol for typed attribute values by philprime in #7077
  • Allow alpha releases on RNSentry.podspec for Cross Platform Test by itaybre in #7130
  • Remove swift5.9 checks by itaybre in #7098
  • Remove duplicate file in project by itaybre in #7093
  • Convert SentryMetricKitIntegration to Swift by noahsmartin in #7076
  • Removes HybridSDK subspec by itaybre in #7019
  • Move testRemoveImageFromTail to flaky plan by itaybre in #7041
  • Use at least xcode 16 for all jobs by itaybre in #7012
  • Cleanup file filter for required files modified by itaybre in #7031
  • Remove assembly workflow files from UI test filter by itaybre in #7030
  • Bumps macOS-14 runner to macOS-15 by itaybre in #7029
  • Ensure required simulators are loaded for all platforms by itaybre in #7022

Other

  • test: Add Options Documentation Sync Tests by philipphofmann in #7075

🤖 This preview updates automatically when you update the PR.

@philprime
Copy link
Member Author

All PRs are now ready to be merged and approved. Starting stacked merge process

@philprime philprime added Waiting for: CI 🤖 Marks PR as ready-for-merge when CI passes. To be replaced with required checks. and removed dontmerge A branch that absolutely should not be merged while this label is applied. labels Jan 15, 2026
@philprime philprime merged commit 2f28bda into main Jan 15, 2026
312 of 323 checks passed
@philprime philprime deleted the philprime/metrics-bootstrap branch January 15, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows Waiting for: CI 🤖 Marks PR as ready-for-merge when CI passes. To be replaced with required checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Metrics] Add integration bootstrapping

2 participants